package com.ly.web.controller.erp;

import com.ly.common.annotation.Log;
import com.ly.common.core.controller.BaseController;
import com.ly.common.core.domain.AjaxResult;
import com.ly.common.enums.BusinessType;
import com.ly.common.utils.poi.ExcelUtil;
import com.ly.heart.domain.KingBaseTaxRateSystemEntity;
import com.ly.heart.service.IKingBaseTaxRateSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 金蝶-税率-税种 前端控制器
 * </p>
 * @author WuZH
 * @since 2024-08-20
 */
@Api(value = "info", tags = "金蝶-税率-税收制度")
@RestController
@RequestMapping ("/heart/KingBaseTaxRateSystem")
public class KingBaseTaxRateSystemController extends BaseController {

    @Resource
    private IKingBaseTaxRateSystemService kingBaseTaxRateSystemService;

    @PreAuthorize("@ss.hasPermi('heart:KingBaseTaxRateSystem:list')")
    @PostMapping("/list")
    @ApiOperation("查询金蝶-税率-税收制度列表")
    public AjaxResult getKingBaseTaxRateSystemList(@RequestBody KingBaseTaxRateSystemEntity kingBaseTaxRateSystemEntity){
        return kingBaseTaxRateSystemService.getKingBaseTaxRateSystemList(kingBaseTaxRateSystemEntity);
    }


    /**
     * 导出金蝶-税率-税收制度列表
     */
    @PreAuthorize("@ss.hasPermi('heart:KingBaseTaxRateSystem:export')")
    @Log(title = "金蝶-税率-税收制度", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    @ApiOperation("导出金蝶-税率-税收制度列表")
    public AjaxResult export(KingBaseTaxRateSystemEntity kingBaseTaxRateSystemEntity)
    {
        List<KingBaseTaxRateSystemEntity> list = kingBaseTaxRateSystemService.selectKingBaseTaxRateSystemEntityList(kingBaseTaxRateSystemEntity);
        ExcelUtil<KingBaseTaxRateSystemEntity> util = new ExcelUtil<KingBaseTaxRateSystemEntity>(KingBaseTaxRateSystemEntity.class);
        return util.exportExcel(list, "info");
    }

    /**
     * 获取金蝶-税率-税收制度详细信息
     */
    @PreAuthorize("@ss.hasPermi('heart:KingBaseTaxRateSystem:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取金蝶-税率-税收制度详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(kingBaseTaxRateSystemService.selectKingBaseTaxRateSystemEntityById(id));
    }

    /**
     * 新增金蝶-税率-税收制度
     */
    @PreAuthorize("@ss.hasPermi('heart:KingBaseTaxRateSystem:add')")
    @Log(title = "金蝶-税率-税收制度", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增金蝶-税率-税收制度")
    public AjaxResult add(@RequestBody KingBaseTaxRateSystemEntity kingBaseTaxRateSystemEntity)
    {
        return toAjax(kingBaseTaxRateSystemService.insertKingBaseTaxRateSystemEntity(kingBaseTaxRateSystemEntity));
    }

    /**
     * 修改金蝶-税率-税收制度
     */
    @PreAuthorize("@ss.hasPermi('heart:KingBaseTaxRateSystem:edit')")
    @Log(title = "金蝶-税率-税收制度", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改金蝶-税率-税收制度")
    public AjaxResult edit(@RequestBody KingBaseTaxRateSystemEntity kingBaseTaxRateSystemEntity)
    {
        return toAjax(kingBaseTaxRateSystemService.updateKingBaseTaxRateSystemEntity(kingBaseTaxRateSystemEntity));
    }

    /**
     * 删除金蝶-税率-税收制度
     */
    @PreAuthorize("@ss.hasPermi('heart:KingBaseTaxRateSystem:remove')")
    @Log(title = "金蝶-税率-税收制度", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除金蝶-税率-税收制度")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(kingBaseTaxRateSystemService.deleteKingBaseTaxRateSystemEntityByIds(ids));
    }

    @Log (title = "禁用金蝶-税率-税收制度", businessType = BusinessType.DELETE)
    @RequestMapping ("disabled")
    @ApiOperation ("禁用金蝶-税率-税收制度")
    public AjaxResult disabled (String id) {
        return kingBaseTaxRateSystemService.disabled ( id );
    }



}
